import Vue from 'vue'
import VueRouter from 'vue-router';
Vue.use(VueRouter)
import Layout from '@/Layout/index.vue'
const routes = [
  {
    path: '/',
    redirect: '/code'
  },
  {
    path: '/code',
    name: 'code',
    component: Layout,
    children: [
      {
        path: '/code',
        name: 'code',
        component: () => import('@/views/code.vue')
      },
      {
        path: '/search',
        name: 'search',
        component: () => import('@/views/search.vue')
      }
    ]
  },
]

const router = new VueRouter({
  routes,
  scrollBehavior(to, from, savedPosition) {
    return { x: 0, y: 0 }
  }
})

export default router
